<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>获取 URL 参数, 并转换为对象类型</title>
</head>

<body>
  <script>
    let url = 'http://item.taobao.com/item.htm?a=1&b=2&c=&d=shmhm'
    var obj = {}
    var str = url.split("?")[1].split("&")
    for (var i = 0; i < str.length; i++) {
      var a = str[i].split('=')
      obj[a[0]] = a[1]
    }
    console.log(obj)
  </script>
</body>

</html>